package semantic;

public class Flag {
	
	/**
	 * It can save a boolean, the difference of boolean type and itself is as follows:
	 * 		A boolean type can only be a storage in JAVA. Anywhere outside the class can't change it
	 * 		Instance of class which contains boolean type is a pointer, point to a storage. Somewhere outside the class where create the instance can change it.
	 * 	It can support check if there is any 'exit' in loop
	 * It can support check if there is any 'return' in function declaration
	 * Note: a single boolean type can not achieve that since when meet a 'exit', we can't change the boolean, since we are out of loop node
	 */
	
	private boolean meetExit = false;

	public Flag(boolean b) {
		meetExit = b;
	}

	public boolean get() {
		return meetExit;
	}

	public void set(boolean meetExit) {
		this.meetExit = meetExit;
	}
	
	public boolean equals( boolean b ){
		return meetExit==b;
	}

}
